<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.List"%>
<%@page import="java.sql.Connection"%>
<%@page import="by.epam.communalservices.dao.jdbc.JdbcDaoJkhObject"%>
<%@page import="by.epam.communalservices.entity.JkhObject"%>
<%@page import="by.epam.communalservices.dao.jdbc.JdbcDaoUser"%>
<%@page import="by.epam.communalservices.entity.User"%>


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/connect" prefix="connect"%>
<%@ taglib tagdir="/WEB-INF/tags/table" prefix="table"%>
<%@ taglib tagdir="/WEB-INF/tags/object" prefix="object"%>

<connect:isset/>
<connect:denny rules="admin,view,object_view,objecter" />

<connect:display rules="admin,view,object_view">
	<object:list/>
</connect:display>
<connect:display rules="objecter">
	<object:list owner="${sessionScope.currentUser.id}" />
</connect:display>

<table:body style="width:98%;">
	<table:title span="9">
	   Object List!!!
	</table:title>
	<table:head names="id,address,ten_surname,ten_name,ten_patronymic,last_repair,idOwner,task,action" />
	<c:set var="index" value="0" />
	<c:forEach items="${requestScope.objectList}" var="object">
		<c:set var="index" value="${index + 1}" />
		<object:line object="${object}" dif="${index mod 2 eq 0 ? 'c' : 'n'}" />	
	</c:forEach>

	<table:title span="9" down="yes">
		<connect:display rules="admin,object_edit,edit">
			<button onclick="document.location.href='object_edit'"
				style='float: right;'>Add New Object</button>
		</connect:display>
	</table:title>

</table:body>
